import request from '@/router/axios';
import {baseUrl} from '@/config/env';
// import { ymdFormat } from "@/util/date";

export const getPages = (page, limit, params) => {
  return request({
    url: baseUrl + '/api/require/getpages',
    method: 'get',
    params: {
      key:params.description==undefined?'':params.description,
      type:params.status==undefined?'':params.status,
      // time:params.logged==undefined?'':ymdFormat(params.logged[0])+'_'+ymdFormat(params.logged[1]),
      page,
      limit,
    }
  })
}
export const myPages = (page, limit, params) => {
  return request({
    url: baseUrl + '/api/require/mypages',
    method: 'get',
    params: {
      key:params.description==undefined?'':params.description,
      type:params.status==undefined?'':params.status,
      page,
      limit,
    }
  })
}
export const todoPages = (page, limit, params) => {
  return request({
    url: baseUrl + '/api/require/todopages',
    method: 'get',
    params: {
      key:params.description==undefined?'':params.description,
      type:params.status==undefined?'':params.status,
      page,
      limit,
    }
  })
}
export const remove = (ids) => {
  return request({
    url: baseUrl + '/api/require/remove',
    method: 'post',
    params: {
      ids,
    }
  })
}

export const add = (row) => {
  return request({
    url: baseUrl + '/api/require/add',
    method: 'post',
    data: row
  })
}

export const update = (row) => {
  return request({
    url: baseUrl + '/api/require/edit',
    method: 'post',
    data: row
  })
}
export const getDetail = (id) => {
  return request({
    url: baseUrl + '/api/require/detail',
    method: 'get',
    params: {
      id,
    }
  })
}